package com.teaching.service.impl;

import com.teaching.mapper.TeachingMapper;
import com.teaching.service.TeachingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author
 * @since
 */
@Service
public class TeachingServiceImpl implements TeachingService {

	@Autowired
	TeachingMapper teachingMapper;
 
    
    public void add(Map<String, Object> params) {
		teachingMapper.add(params);
	}
 

    public Map<String, Object> queryList(Map<String, Object> params) {
		params.put("page",
				(Integer.valueOf(params.get("page").toString()) - 1) * Integer.valueOf(params.get("limit").toString()));
		List<Map<String, Object>> list = teachingMapper.queryList(params);
		int count = teachingMapper.queryCount(params);
		params = new HashMap<String, Object>();
		params.put("list", list);
		params.put("count", count);
		return params;
	}
	

	public Map<String, Object> queryDetail(String id) {
		
		Map<String, Object> result = teachingMapper.queryDetail(id);
		return result;
	}


	public void update(Map<String, Object> params) {

		teachingMapper.update(params);
	}

	public void delete(String id) {

		teachingMapper.delete(id);
	}

}
